const express = require('express');
const app = new express();
const userRouter = require("./routes/users");
const categoryRouter = require("./routes/category");

const cors = require("cors");
const path = require("path");
//配置post发送文本数据
app.use(express.urlencoded({ extended: false }));
app.use(express.json())

app.use(cors());
app.use(express.static(path.join(__dirname, "public")));

app.use("/public", express.static(path.join(__dirname, "public")));

//应用级中间件
app.use("/api/user", userRouter);
app.use("/api/category", categoryRouter);




app.listen(3008, () => {
    console.log("3008端口开启");
})